package com.xhs.config;

import com.fhs.trans.service.impl.DictionaryTransService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @desc: easy-trans 字典翻译
 * @projectName: spring-boot-demo
 * @author: xhs
 * @date: 2024-07-14 014 22:31
 * @version: JDK 1.8
 */
@Slf4j
@Configuration
public class DictionaryConfig implements InitializingBean {

    @Resource
    private DictionaryTransService dictionaryTransService;
    @Override
    public void afterPropertiesSet() throws Exception {
        //将字典缓存刷新到翻译服务中
        Map<String,String> transMap = new HashMap<>();
        transMap.put("1","未认证");
        transMap.put("2","认证中");
        transMap.put("3","认证失败");
        transMap.put("4","已认证");
        log.info("easy-trans 字典翻译");
        dictionaryTransService.refreshCache("status",transMap);

    }
}
